package com.tbit.uqbike.object.pojo.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.tbit.uqbike.annos.Excel;
import lombok.Data;

/**
 * 用户余额详情
 *
 * @Author:BUGTian
 * @DATE: 2022/5/28
 */
@Data
public class SubAccountUserBalanceVO {

    /**
     * 用户id
     */
    private String userId;


    /**
     * 手机号
     */
    @Excel(name = "手机号", sort = 1)
    private String phone;

    /**
     * 余额
     */
    private Long money;

    /**
     * 汇付余额
     */
    private Long adaPayMoney;

    /**
     * 非汇付余额
     */
    private Long amount;

    /**
     * 余额 (单位元)
     */
    @JSONField(serialize = false)
    @Excel(name = "余额", sort = 2)
    private String moneyYuan;

    /**
     * 汇付余额 (单位元)
     */
    @JSONField(serialize = false)
    @Excel(name = "汇付余额", sort = 3)
    private String adaPayMoneyYuan;

    /**
     * 非汇付余额（单位元）
     */
    @JSONField(serialize = false)
    @Excel(name = "非汇付余额", sort = 4)
    private String amountYuan;

    /**
     * 金额导出单位转换为元 保留两位小数
     */
    public void unitConversion() {
        //分转为元,保留两位小数
        this.moneyYuan = String.format("%.2f", ((double) money / 100D));
        this.adaPayMoneyYuan = String.format("%.2f", ((double) adaPayMoney / 100D));
        this.amountYuan = String.format("%.2f", ((double) amount / 100D));
    }

}
